package com.qf.mapper;

import com.qf.entity.SysUser;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.Set;

public interface SysUserMapper {
    @Select("select * from sys_user where username=#{username}")
    SysUser loginByUsername(String username);
    @Select("SELECT DISTINCT sp.perm_tag\n" +
            "    FROM sys_user_role sur\n" +
            "    inner join sys_role_permission srp\n" +
            "    on sur.role_id = srp.role_id\n" +
            "    inner join sys_permission sp\n" +
            "    on sp.id = srp.perm_id\n" +
            "    where sur.user_id = #{id}")
    Set<String> selectAuthsById(Integer id);

    @Insert("insert into sys_user(username,password) values(#{username},#{password})")
    void save(SysUser sysUser);
}
